package hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.beans.FAQ;

/**
 * Created by Administrator on 2016/1/26.
 */
public class FAQAdapter extends BaseAdapter {

    private static final String TAG = "FAQAdapter";
    private Context context;
    private List<FAQ> list;

    public FAQAdapter(Context context, List<FAQ> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_setting_faq,null);
            BaseApplication.scaleScreenHelper.loadView(((ViewGroup) convertView));
            holder.textView = ((TextView) convertView.findViewById(R.id.mine_setting_faq_title));
            holder.view = convertView.findViewById(R.id.mine_setting_faq_fengeixian);
            convertView.setTag(holder);
        }
        holder = ((ViewHolder) convertView.getTag());
        holder.textView.setText(list.get(position).getTitle());

        if(position == getCount() - 1){
            holder.view.setVisibility(View.GONE);
        }


        return convertView;
    }

    class ViewHolder{
        TextView textView;
        View view;
    }

}
